<template>
	<view class="form">
		<Form :formList="formList" :ysrName="ysrName" :jhrName="jhrName" :name="name" :zyqy="zyqyName" ref="baseForm">
		</Form>
		<view class="formINFO" ref="HotWork">
			<!-- <base-form v-model="formModel" :labelWidth="100" :formList="formList">
				<view slot="testSlot"> 这里可以是一个未定义的组件 </view>
				<view slot="testSlot1"> 这里可以是一个未定义的组件1 </view>
			</base-form> -->
			<view class="titles">
				危害辨识
			</view>
			<view class="harm">
				<u-checkbox-group v-model="whbsName" placement="column">
					<u-checkbox :customStyle="{marginBottom: '8px'}" v-for="(item, index) in whbsName" :key="index"
						:label="item.name" :name="item.name" :disabled="item.disabled" :checked='true'>
					</u-checkbox>
				</u-checkbox-group>
			</view>
			<view class="titles">
				安全措施
			</view>
			<view class="measure">
				<u-checkbox-group v-model="aqcsName" placement="column">
					<u-checkbox :customStyle="{marginBottom: '8px'}" v-for="(item, index) in aqcsName" :key="index"
						:label="item.name" :name="item.name" :disabled="item.disabled" :checked='true'>
					</u-checkbox>
				</u-checkbox-group>
			</view>
			<view class="titles">
				个人用品防护
			</view>
			<view class="measure">
				<u-checkbox-group v-model="grypName" placement="column">
					<u-checkbox :customStyle="{marginBottom: '8px'}" v-for="(item, index) in grypName" :key="index"
						:label="item.name" :name="item.name" :disabled="item.disabled" :checked='true'>
					</u-checkbox>
				</u-checkbox-group>
			</view>
			<view class="titles">
				气体检测
			</view>
			<view class="qtjc">
				<u--form labelPosition="left" :model="form" label-width="200rpx">
					<!-- 	<u-form-item label="姓名" prop="name" borderBottom ref="item1">
					<u--input v-model="form.name" :disabled="true" border="none"></u--input>
				</u-form-item> -->
					<u-form-item label="取样分析时间" prop="qyfxsj" borderBottom ref="item1">
						<u--input v-model="form.qyfxsj" :disabled="true" border="none"></u--input>
					</u-form-item>
					<u-form-item label="代表性气体" prop="dbxqt" borderBottom ref="item1">
						<u--input v-model="form.dbxqt" :disabled="true" border="none"></u--input>
					</u-form-item>
					<u-form-item label="取样分析部位" prop="qyfxbw" borderBottom ref="item1">
						<u--input v-model="form.qyfxbw" :disabled="true" border="none"></u--input>
					</u-form-item>
					<u-form-item label="可燃气体LEL%" prop="krqt" borderBottom ref="item1">
						<u--input v-model="form.krqt" :disabled="true" border="none"></u--input>
					</u-form-item>
					<u-form-item label="有毒气体ppms" prop="ydqt" borderBottom ref="item1">
						<u--input v-model="form.ydqt" :disabled="true" border="none"></u--input>
					</u-form-item>
					<u-form-item label="氧含量" prop="yhl" borderBottom ref="item1">
						<u--input v-model="form.yhl" :disabled="true" border="none"></u--input>
					</u-form-item>
					<u-form-item label="分析人" prop="fxr" borderBottom ref="item1">
						<u--input v-model="form.fxr" :disabled="true" border="none"></u--input>
					</u-form-item>
					<!-- <u-form-item label="分析签字" prop="fxrqz" borderBottom ref="item1">
					<u--input v-model="form.fxrqz" :disabled="true" border="none"></u--input>
				</u-form-item> -->
				</u--form>
			</view>
			<view class="titles">
				审核人/部门选择
			</view>
			<view class="shrbmxz">
				<u--form labelPosition="left" :model="form1" label-width="200rpx">
					<u-form-item :label="item.name" prop="qyfxsj" v-for="item in formData" :key="item.name" borderBottom
						ref="item1">
						<u--input v-model="item.value" :disabled="true" border="none"></u--input>
					</u-form-item>
				</u--form>
			</view>
			<view class="btns">
				<view class="bh btn">
					<u-button @click="bohui" text="驳回"></u-button>
				</view>
				<view class="tg btn">
					<u-button type="primary" @click="submit" text="通过"></u-button>
				</view>
			</view>
	
		</view>
	</view>
</template>

<script>
	import Form from '@/pages/Components/formMessageTwo/formMessageTwo'
	// import Form from "@/pages/Components/Base/BaseForm/BaseForm";
	import {
		approve
	} from '../../../api/space.js'
	export default {
		components: {
			Form,
		},
		data() {
			return {
				formModel: {
					name: "",
					userPicker: "",
					datetime: "",
					picker: "",
					textarea: "",
				},
				pageCheck: 0,
				btnMessage: {
					state: false,
					cancels: '上一步',
					submit: '下一步',
				},
				formList: [],
				obj: {},
				zyqy: null,
				zyqyName:null,
				ysrName: null,
				jhrName: null,
				name: null,
				whbsName: [],
				aqcsName: [],
				grypName: [],
				form: {},
				form1: {},
				formData: [],
			};
		},
		onLoad(obj) { 
			this.obj = JSON.parse(obj.details)
			let msg = []
			JSON.parse(this.obj.jsonwbnr).forEach((e) => {
				if (e.name !== 'zyqy' && e.name !== '作业区域' && e.name !== '作业名称') {
					msg.push(e)
				}
			})
			this.formList = msg
			this.zyqy = this.obj.zyqy
			this.ysrName = this.obj.ysrName
			this.zyqyName = this.obj.zyqyName
			this.jhrName = this.obj.jhrName
			this.name = this.obj.name
			// this.whbsName = this.obj.whbsName 
			let ary = []
			this.obj.whbsName.forEach(e => {
				ary.push({
					name: e,
					disabled: true
				})
			});
			this.whbsName = ary
			let arr = []
			this.obj.aqcsName.forEach(e => {
				arr.push({
					name: e,
					disabled: true
				})
			});
			this.aqcsName = arr
			let arry = []
			this.obj.grypName.forEach(e => {
				arry.push({
					name: e,
					disabled: true
				})
			});
			this.grypName = arry
			this.form = this.obj.qtjc
			console.log(this.obj);
			let arrys = []
			this.obj.tzypshrjlxxes.forEach(e => {
				arrys.push({
					name: e.rypz,
					value: e.ry
				})
			});
			this.formData = arrys
		},
		methods: {
			submit() {
				uni.navigateTo({
					url: `/pages/approval/transit/transit?details=${JSON.stringify(this.obj)}`,
				})
			},
			bohui() {
				uni.navigateTo({
					url: `/pages/approval/bohui/bohui?details=${JSON.stringify(this.obj)}`,
				})
			}
			// cardSubmit(){
			// 	this.pageCheck++
			// },
			// cardSubmit(){
			// 	this.pageCheck++
			// }
			// ,{
			//     "path" : "pages/approval/transit/transit",
			//     "style" :
			//     {
			//         "navigationBarTitleText": "签字",
			//         "enablePullDownRefresh": false
			//     }

			// }
		}
	}
</script>

<style lang="scss">
	.form {
		height: 100vh;
		overflow-y: auto;
		background: #f6f6f6;

		.formINFO {
			border-radius: 8px;
			background: #FFF;
			padding: 20rpx 45rpx;
			margin: 50rpx 30rpx;

			.titles {
				margin: 20rpx 10rpx 10rpx;
				padding: 20rpx 0;
				font-size: 28rpx;
				color: #666;
			}

			.harm {
				width: 100%;
				height: 400rpx;
				padding: 20rpx;
				box-sizing: border-box;
				border-radius: 16rpx;
				background-color: #f5f5f5;
				overflow-y: auto;
			}

			.measure {
				width: 100%;
				height: 600rpx;
				padding: 20rpx;
				box-sizing: border-box;
				border-radius: 16rpx;
				background-color: #f5f5f5;
				overflow-y: auto;
			}

			.btns {
				width: 100%;
				margin: 40rpx 0 20rpx;
				height: 80rpx;
				display: flex;
				justify-content: space-between;

				.btn {
					width: 280rpx;
					height: 80rpx;

					// background-color: aqua;
					.u-button {
						border: none;
					}
				}
			}
		}
	}
</style>
